home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 256_01 / endproc.a < prev    next >
Encoding:
Text File  |  1988-01-06  |  1.9 KB  |  50 lines

  1. ;---------------------------------------------------------------------
  2. ;    ASM88 FILE:     ENDPROC.A     End Process
  3. ;    ----------
  4. ;    WRITTEN:        25/10/87
  5. ;    -------
  6. ;    PURPOSE:        This is one of a series of files which take
  7. ;    -------         advantage of INT 21H functions under MS-DOS.
  8. ;                    In each case the error situation is marked by
  9. ;                    the carry flag being set.   We use the De Smet
  10. ;                    external variable '_carryf' to see whether the
  11. ;                    carry is set on return from the function.
  12. ;                    If so, the error code can be used to obtain
  13. ;                    information about the specific error.
  14. ;
  15. ;    USAGE:          void ENDPROC(ret_code)
  16. ;    -----           int ret_code;  /* can be retrieved by the
  17. ;                                      parent using Function 4dh */
  18. ;
  19. ;    DEPENDENCIES:           De Smet C V 2.44+
  20. ;    ------------
  21. ;    Copyright 1987 - Cogar Computer Services Pty. Ltd
  22. ;---------------------------------------------------------------------
  23.  
  24. CSEG
  25. PUBLIC ENDPROC_
  26.  
  27. ENDPROC_:
  28.     push    bp    ; normal De Smet C start
  29.     mov    bp,sp    ; point to the stack
  30.     mov    ax,ds    ; and make ES common with DS
  31.     mov    es,ax
  32. ;----------------------------------------------------------------------
  33. ;  The unique programme follows.
  34. ;----------------------------------------------------------------------
  35.     mov    byte al,[bp+4]    ; the return code
  36.     mov    ah,4ch
  37.     int    21h
  38.     jc    ENDPROC_ERROR
  39.     jmp    ENDPROC_QUIT
  40. ENDPROC_ERROR:
  41.     mov    si,[bp+6]    ; get address of '_carryf' variable
  42.     mov    byte [si],1    ; return with _carryf = 1
  43. ;----------------------------------------------------------------------
  44. ;  Normal programme termination.
  45. ;----------------------------------------------------------------------
  46. ENDPROC_QUIT:
  47.     pop    bp    ; restore starting conditions
  48.     ret
  49. ;----------------------------------------------------------------------
  50.